var indexData = require("../indexdata/indexdata.js");
var inviteHomedata = require('../inviteHomedata/inviteHomedata.js')
var num = 0;
var scrollHeight=360;
Page({
  data: {
    winHeight: 0,
    winWidth: 0,
    twoBtn: false,
    winHeight: '100%',
    toView: 'classif8',
    toView2: '',
    nowstatus: 'classif8',
    nowstatus2: 'classifDetail0',//二级菜单
    currentTab1: '',
    currentTab2: '',
    names: 1,
    classifData: [
      {
        'index': 0,
        'id': 'classif0',
        'name': '单日购买',
        'scrollTop': '',
        'img':'../images/indexDetails/dancigou.png',
        'classifDetail': [
          {
            'index': 0,
            'id': 'classifDetail0',
            'name': '单日购买',
            'scrollTop': '',
            'usedata':[
                {
                  "flxh": "0",
                  "spid": "1",
                  "number": "1",
                  "newText": "最高减100元",
                  "newShow": false,
                  "newShowRed": false,
                  "productImg": "../images/index/1.png",
                  "name": "特地欧顿至尊酸牛奶",
                  "salesVolume": "6",
                  "recommendText": "推荐产品",
                  "recommendShow": false,
                  "price": "16.00",
                  'index': '0-0-0',//下标
                  'countNum': '0',//输入框
                  'minusBtn': true,//是否有减号输入框
                  'waysofPurchasing': '3',//购买方式1图标2文字3加减
                  'shouqing': false//是否售罄
                },
                {
                  "flxh": "0",
                  "spid": "2",
                  "number": "2",
                  "newText": "热销上市",
                  "newShow": false,
                  "newShowRed": true,
                  "productImg": "../images/index/2.png",
                  "name": "特地欧顿至尊酸牛奶特地欧顿至尊酸牛奶特地欧顿至尊酸牛奶特地欧顿至尊酸牛奶",
                  "salesVolume": "9",
                  "recommendText": "推荐产品",
                  "recommendShow": false,
                  "price": "156.00",
                  'index': '0-0-1',//下标
                  'countNum': '0',//输入框
                  'minusBtn': true,//是否有减号输入框
                  'waysofPurchasing': '1',//购买方式1图标2文字3加减
                  'shouqing': false//是否售罄

                },
                {
                  "flxh": "1",
                  "spid": "3",
                  "number": "3",
                  "newText": "热销上市",
                  "newShow": true,
                  "newShowRed": true,
                  "productImg": "../images/index/3.png",
                  "name": "特地欧顿至尊酸牛奶",
                  "salesVolume": "8",
                  "recommendText": "推荐产品",
                  "recommendShow": true,
                  "price": "1.00",
                  'index': '0-0-2',//下标
                  'countNum': '0',//输入框
                  'minusBtn': true,//是否有减号
                  'waysofPurchasing': '2',//购买方式1图标2文字3加减
                  'shouqing': true,//是否售罄
                },
                {
                  "flxh": "2",
                  "spid": "4",
                  "number": "4",
                  "newText": "热销上市",
                  "newShow": false,
                  "newShowRed": true,
                  "productImg": "../images/index/4.png",
                  "name": "特地欧顿至尊酸牛奶",
                  "salesVolume": "7",
                  "recommendText": "推荐产品",
                  "recommendShow": true,
                  "price": "1.00",
                  'index': '0-0-3',//下标
                  'countNum': '0',//输入框
                  'minusBtn': true,//是否有减号
                  'waysofPurchasing': '1',//购买方式1图标2文字3加减
                  'shouqing': false//是否售罄
                },
              ]
          },      
        ]
      },
      {
        'index': 1,
        'id': 'classif1',
        'name': '新鲜蔬菜',
        'scrollTop': '',
        'img': '../images/indexDetails/xinxianshucai.png',
        'classifDetail': [
          {
            'index': 1,
            'id': 'classifDetail1',
            'name': '新鲜蔬菜',
            'scrollTop': '',
            'usedata': [
              {
                "flxh": "0",
                "spid": "1",
                "number": "1",
                "newText": "最高减100元",
                "newShow": false,
                "newShowRed": false,
                "productImg": "../images/index/product/shucai/1.png",
                "name": "菠菜",
                "salesVolume": "6",
                "recommendText": "推荐产品",
                "recommendShow": false,
                "price": "16.00",
                'index': '1-0-0',//下标
                'countNum': '0',//输入框
                'minusBtn': true,//是否有减号输入框
                'waysofPurchasing': '3',//购买方式1图标2文字3加减
                'shouqing': false//是否售罄
              },
              {
                "flxh": "0",
                "spid": "2",
                "number": "2",
                "newText": "热销上市",
                "newShow": false,
                "newShowRed": true,
                "productImg": "../images/index/product/shucai/2.png",
                "name": "洋葱",
                "salesVolume": "9",
                "recommendText": "推荐产品",
                "recommendShow": false,
                "price": "156.00",
                'index': '1-0-1',//下标
                'countNum': '0',//输入框
                'minusBtn': true,//是否有减号输入框
                'waysofPurchasing': '1',//购买方式1图标2文字3加减
                'shouqing': false//是否售罄

              },
              {
                "flxh": "1",
                "spid": "3",
                "number": "3",
                "newText": "热销上市",
                "newShow": true,
                "newShowRed": true,
                "productImg": "../images/index/product/shucai/3.png",
                "name": "小白菜",
                "salesVolume": "8",
                "recommendText": "推荐产品",
                "recommendShow": true,
                "price": "1.00",
                'index': '1-0-2',//下标
                'countNum': '0',//输入框
                'minusBtn': true,//是否有减号
                'waysofPurchasing': '2',//购买方式1图标2文字3加减
                'shouqing': true,//是否售罄
              },
              {
                "flxh": "2",
                "spid": "4",
                "number": "4",
                "newText": "热销上市",
                "newShow": false,
                "newShowRed": true,
                "productImg": "../images/index/product/shucai/4.png",
                "name": "西红柿",
                "salesVolume": "7",
                "recommendText": "推荐产品",
                "recommendShow": true,
                "price": "1.00",
                'index': '1-0-3',//下标
                'countNum': '0',//输入框
                'minusBtn': true,//是否有减号
                'waysofPurchasing': '1',//购买方式1图标2文字3加减
                'shouqing': false//是否售罄
              },
              {
                "flxh": "2",
                "spid": "5",
                "number": "5",
                "newText": "热销上市",
                "newShow": false,
                "newShowRed": true,
                "productImg": "../images/index/product/shucai/5.png",
                "name": "蔬菜礼盒",
                "salesVolume": "6",
                "recommendText": "推荐产品",
                "recommendShow": true,
                "price": "1.00",
                'index': '1-0-4',//下标
                'countNum': '0',//输入框
                'minusBtn': true,//是否有减号
                'waysofPurchasing': '3',//购买方式1图标2文字3加减
                'shouqing': false,//是否售罄
              },
            ]
          },
          {
            'index': 2,
            'id': 'classifDetail12',
            'name': '绿植',
            'scrollTop': '',
            'usedata': [
              {
                "flxh": "0",
                "spid": "1",
                "number": "1",
                "newText": "最高减100元",
                "newShow": false,
                "newShowRed": false,
                "productImg": "../images/index/product/shucai/5.png",
                "name": "吊兰",
                "salesVolume": "6",
                "recommendText": "推荐产品",
                "recommendShow": false,
                "price": "16.00",
                'index': '1-1-0',//下标
                'countNum': '0',//输入框
                'minusBtn': true,//是否有减号输入框
                'waysofPurchasing': '3',//购买方式1图标2文字3加减
                'shouqing': false//是否售罄
              },
            ]
          },
        ]
      },
      {
        'index': 2,
        'id': 'classif2',
        'name': '时令水果',
        'scrollTop': '',
        'img': '../images/indexDetails/shilingshuiguo.png',
        'classifDetail': [
          {
            'index': 2,
            'id': 'classifDetail2',
            'name': '时令水果',
            'scrollTop': '',
            'usedata': [
              {
                "flxh": "0",
                "spid": "1",
                "number": "1",
                "newText": "最高减100元",
                "newShow": false,
                "newShowRed": false,
                "productImg": "../images/index/product/shuiguo/1.png",
                "name": "橘子",
                "salesVolume": "6",
                "recommendText": "推荐产品",
                "recommendShow": false,
                "price": "16.00",
                'index': '2-0-0',//下标
                'countNum': '0',//输入框
                'minusBtn': true,//是否有减号输入框
                'waysofPurchasing': '3',//购买方式1图标2文字3加减
                'shouqing': false//是否售罄
              },
              {
                "flxh": "0",
                "spid": "2",
                "number": "2",
                "newText": "热销上市",
                "newShow": false,
                "newShowRed": true,
                "productImg": "../images/index/product/shuiguo/2.png",
                "name": "果橙",
                "salesVolume": "9",
                "recommendText": "推荐产品",
                "recommendShow": false,
                "price": "156.00",
                'index': '2-0-1',//下标
                'countNum': '0',//输入框
                'minusBtn': true,//是否有减号输入框
                'waysofPurchasing': '1',//购买方式1图标2文字3加减
                'shouqing': false//是否售罄

              },
              {
                "flxh": "1",
                "spid": "3",
                "number": "3",
                "newText": "热销上市",
                "newShow": true,
                "newShowRed": true,
                "productImg": "../images/index/product/shuiguo/3.png",
                "name": "火龙果",
                "salesVolume": "8",
                "recommendText": "推荐产品",
                "recommendShow": true,
                "price": "1.00",
                'index': '2-0-2',//下标
                'countNum': '0',//输入框
                'minusBtn': true,//是否有减号
                'waysofPurchasing': '2',//购买方式1图标2文字3加减
                'shouqing': true,//是否售罄
              },
              {
                "flxh": "1",
                "spid": "3",
                "number": "3",
                "newText": "热销上市",
                "newShow": true,
                "newShowRed": true,
                "productImg": "../images/index/product/shuiguo/4.png",
                "name": "芒果",
                "salesVolume": "8",
                "recommendText": "推荐产品",
                "recommendShow": true,
                "price": "1.00",
                'index': '2-0-2',//下标
                'countNum': '0',//输入框
                'minusBtn': true,//是否有减号
                'waysofPurchasing': '2',//购买方式1图标2文字3加减
                'shouqing': true,//是否售罄
              },
              {
                "flxh": "1",
                "spid": "3",
                "number": "3",
                "newText": "热销上市",
                "newShow": true,
                "newShowRed": true,
                "productImg": "../images/index/product/shuiguo/5.png",
                "name": "水蜜桃",
                "salesVolume": "8",
                "recommendText": "推荐产品",
                "recommendShow": true,
                "price": "1.00",
                'index': '2-0-2',//下标
                'countNum': '0',//输入框
                'minusBtn': true,//是否有减号
                'waysofPurchasing': '2',//购买方式1图标2文字3加减
                'shouqing': true,//是否售罄
              },
            ]
          },
        ]
      },
      {
        'index': 3,
        'id': 'classif3',
        'name': '水产冻品',
        'scrollTop': '',
        'img': '../images/indexDetails/shuichandongpin.png',
        'classifDetail': [
          {
            'index': 3,
            'id': 'classifDetail3',
            'name': '水产冻品',
            'scrollTop': '',
            'usedata': [
              {
                "flxh": "0",
                "spid": "1",
                "number": "1",
                "newText": "最高减100元",
                "newShow": false,
                "newShowRed": false,
                "productImg": "../images/index/product/shuichan/2.png",
                "name": "大闸蟹",
                "salesVolume": "6",
                "recommendText": "推荐产品",
                "recommendShow": false,
                "price": "16.00",
                'index': '3-0-0',//下标
                'countNum': '0',//输入框
                'minusBtn': true,//是否有减号输入框
                'waysofPurchasing': '3',//购买方式1图标2文字3加减
                'shouqing': false//是否售罄
              },
              {
                "flxh": "0",
                "spid": "2",
                "number": "2",
                "newText": "热销上市",
                "newShow": false,
                "newShowRed": true,
                "productImg": "../images/index/product/shuichan/3.png",
                "name": "黄花鱼",
                "salesVolume": "9",
                "recommendText": "推荐产品",
                "recommendShow": false,
                "price": "156.00",
                'index': '3-0-1',//下标
                'countNum': '0',//输入框
                'minusBtn': true,//是否有减号输入框
                'waysofPurchasing': '1',//购买方式1图标2文字3加减
                'shouqing': false//是否售罄

              },
            ]
          },
        ]
      },
      {
        'index': 4,
        'id': 'classif4',
        'name': '肉禽蛋品',
        'scrollTop': '',
        'img': '../images/indexDetails/rouqindanpin.png',
        'classifDetail': [
          {
            'index': 4,
            'id': 'classifDetail4',
            'name': '肉禽蛋品',
            'scrollTop': '',
            'usedata': [
              {
                "flxh": "0",
                "spid": "1",
                "number": "1",
                "newText": "最高减100元",
                "newShow": false,
                "newShowRed": false,
                "productImg": "../images/index/product/shuichan/1.png",
                "name": "鸡蛋",
                "salesVolume": "6",
                "recommendText": "推荐产品",
                "recommendShow": false,
                "price": "16.00",
                'index': '4-0-0',//下标
                'countNum': '0',//输入框
                'minusBtn': true,//是否有减号输入框
                'waysofPurchasing': '3',//购买方式1图标2文字3加减
                'shouqing': false//是否售罄
              },
            ]
          },
        ]
      },
      {
        'index': 5,
        'id': 'classif5',
        'name': '粮油调味',
        'scrollTop': '',
        'img': '../images/indexDetails/liangyoutiaowen.png',
        'classifDetail': [
          {
            'index': 5,
            'id': 'classifDetail5',
            'name': '花生油',
            'scrollTop': '',
            'usedata': [
              {
                "flxh": "0",
                "spid": "1",
                "number": "1",
                "newText": "最高减100元",
                "newShow": false,
                "newShowRed": false,
                "productImg": "../images/index/product/you/1.png",
                "name": "鲁花",
                "salesVolume": "6",
                "recommendText": "推荐产品",
                "recommendShow": false,
                "price": "16.00",
                'index': '5-0-0',//下标
                'countNum': '0',//输入框
                'minusBtn': true,//是否有减号输入框
                'waysofPurchasing': '3',//购买方式1图标2文字3加减
                'shouqing': false//是否售罄
              },
              {
                "flxh": "0",
                "spid": "2",
                "number": "2",
                "newText": "热销上市",
                "newShow": false,
                "newShowRed": true,
                "productImg": "../images/index/product/you/1.png",
                "name": "金龙鱼1:1",
                "salesVolume": "9",
                "recommendText": "推荐产品",
                "recommendShow": false,
                "price": "156.00",
                'index': '5-0-1',//下标
                'countNum': '0',//输入框
                'minusBtn': true,//是否有减号输入框
                'waysofPurchasing': '1',//购买方式1图标2文字3加减
                'shouqing': false//是否售罄

              },
            ]
          },
        ]
      },
      {
        'index': 6,
        'id': 'classif6',
        'name': '休闲食品',
        'scrollTop': '',
        'img': '../images/indexDetails/xiuxianshipin.png',
        'classifDetail': [
          {
            'index': 6,
            'id': 'classifDetail6',
            'name': '休闲食品',
            'scrollTop': '',
            'usedata': [
              {
                "flxh": "0",
                "spid": "1",
                "number": "1",
                "newText": "最高减100元",
                "newShow": false,
                "newShowRed": false,
                "productImg": "../images/index/product/dangaomianbao/1.png",
                "name": "特地面包",
                "salesVolume": "6",
                "recommendText": "推荐产品",
                "recommendShow": false,
                "price": "16.00",
                'index': '6-0-0',//下标
                'countNum': '0',//输入框
                'minusBtn': true,//是否有减号输入框
                'waysofPurchasing': '3',//购买方式1图标2文字3加减
                'shouqing': false//是否售罄
              },
              {
                "flxh": "0",
                "spid": "2",
                "number": "2",
                "newText": "热销上市",
                "newShow": false,
                "newShowRed": true,
                "productImg": "../images/index/product/dangaomianbao/2.png",
                "name": "提拉米苏",
                "salesVolume": "9",
                "recommendText": "推荐产品",
                "recommendShow": false,
                "price": "156.00",
                'index': '6-0-1',//下标
                'countNum': '0',//输入框
                'minusBtn': true,//是否有减号输入框
                'waysofPurchasing': '1',//购买方式1图标2文字3加减
                'shouqing': false//是否售罄

              },
              {
                "flxh": "0",
                "spid": "2",
                "number": "2",
                "newText": "热销上市",
                "newShow": false,
                "newShowRed": true,
                "productImg": "../images/index/product/dangaomianbao/3.png",
                "name": "提拉米苏",
                "salesVolume": "9",
                "recommendText": "推荐产品",
                "recommendShow": false,
                "price": "156.00",
                'index': '6-0-2',//下标
                'countNum': '0',//输入框
                'minusBtn': true,//是否有减号输入框
                'waysofPurchasing': '1',//购买方式1图标2文字3加减
                'shouqing': false//是否售罄

              },
              {
                "flxh": "0",
                "spid": "2",
                "number": "2",
                "newText": "热销上市",
                "newShow": false,
                "newShowRed": true,
                "productImg": "../images/index/product/dangaomianbao/3.png",
                "name": "提拉米苏",
                "salesVolume": "9",
                "recommendText": "推荐产品",
                "recommendShow": false,
                "price": "156.00",
                'index': '6-0-4',//下标
                'countNum': '0',//输入框
                'minusBtn': true,//是否有减号输入框
                'waysofPurchasing': '1',//购买方式1图标2文字3加减
                'shouqing': false//是否售罄

              },
            ]
          },
        ]
      },
      {
        'index': 7,
        'id': 'classif7',
        'name': '居家百货',
        'scrollTop': '',
        'img': '../images/indexDetails/jvjiabaihuo.png',
        'classifDetail': [
          {
            'index': 7,
            'id': 'classifDetail7',
            'name': '居家百货',
            'scrollTop': '',
            'usedata': [
              {
                "flxh": "0",
                "spid": "1",
                "number": "1",
                "newText": "最高减100元",
                "newShow": false,
                "newShowRed": false,
                "productImg": "../images/index/1.png",
                "name": "居家百货",
                "salesVolume": "6",
                "recommendText": "推荐产品",
                "recommendShow": false,
                "price": "16.00",
                'index': '7-0-0',//下标
                'countNum': '0',//输入框
                'minusBtn': true,//是否有减号输入框
                'waysofPurchasing': '3',//购买方式1图标2文字3加减
                'shouqing': false//是否售罄
              },
            ]
          },
        ]
      },
      {
        'index': 8,
        'id': 'classif8',
        'name': '生活服务',
        'scrollTop': '',
        'img': '../images/indexDetails/shenghuofuwu.png',
        'classifDetail': [
          {
            'index': 8,
            'id': 'classifDetail8',
            'name': '生活服务',
            'scrollTop': '',
            'usedata': [
              {
                "flxh": "0",
                "spid": "1",
                "number": "1",
                "newText": "最高减100元",
                "newShow": false,
                "newShowRed": false,
                "productImg": "../images/index/1.png",
                "name": "生活服务",
                "salesVolume": "6",
                "recommendText": "推荐产品",
                "recommendShow": false,
                "price": "16.00",
                'index': '8-0-0',//下标
                'countNum': '0',//输入框
                'minusBtn': true,//是否有减号输入框
                'waysofPurchasing': '3',//购买方式1图标2文字3加减
                'shouqing': false//是否售罄
              },
              {
                "flxh": "0",
                "spid": "2",
                "number": "2",
                "newText": "热销上市",
                "newShow": false,
                "newShowRed": true,
                "productImg": "../images/index/2.png",
                "name": "生活服务",
                "salesVolume": "9",
                "recommendText": "推荐产品",
                "recommendShow": false,
                "price": "156.00",
                'index': '8-0-1',//下标
                'countNum': '0',//输入框
                'minusBtn': true,//是否有减号输入框
                'waysofPurchasing': '1',//购买方式1图标2文字3加减
                'shouqing': false//是否售罄

              },
            ]
          },
        ]
      },
      {
        'index': 9,
        'id': 'classif9',
        'name': '其他',
        'scrollTop': '',
        'img': '../images/indexDetails/qita.png',
        'classifDetail': [
          {
            'index': 9,
            'id': 'classifDetail9',
            'name': '其他',
            'scrollTop': '',
            'usedata': [
              {
                "flxh": "0",
                "spid": "1",
                "number": "1",
                "newText": "最高减100元",
                "newShow": false,
                "newShowRed": false,
                "productImg": "../images/index/1.png",
                "name": "其他",
                "salesVolume": "6",
                "recommendText": "推荐产品",
                "recommendShow": false,
                "price": "16.00",
                'index': '9-0-0',//下标
                'countNum': '0',//输入框
                'minusBtn': true,//是否有减号输入框
                'waysofPurchasing': '3',//购买方式1图标2文字3加减
                'shouqing': false//是否售罄
              },
              {
                "flxh": "0",
                "spid": "2",
                "number": "2",
                "newText": "热销上市",
                "newShow": false,
                "newShowRed": true,
                "productImg": "../images/index/2.png",
                "name": "其他",
                "salesVolume": "9",
                "recommendText": "推荐产品",
                "recommendShow": false,
                "price": "156.00",
                'index': '9-0-1',//下标
                'countNum': '0',//输入框
                'minusBtn': true,//是否有减号输入框
                'waysofPurchasing': '1',//购买方式1图标2文字3加减
                'shouqing': false//是否售罄

              },
              {
                "flxh": "1",
                "spid": "3",
                "number": "3",
                "newText": "热销上市",
                "newShow": true,
                "newShowRed": true,
                "productImg": "../images/index/3.png",
                "name": "其他",
                "salesVolume": "8",
                "recommendText": "推荐产品",
                "recommendShow": true,
                "price": "1.00",
                'index': '9-0-2',//下标
                'countNum': '0',//输入框
                'minusBtn': true,//是否有减号
                'waysofPurchasing': '2',//购买方式1图标2文字3加减
                'shouqing': true,//是否售罄
              },
              {
                "flxh": "2",
                "spid": "4",
                "number": "4",
                "newText": "热销上市",
                "newShow": false,
                "newShowRed": true,
                "productImg": "../images/index/4.png",
                "name": "其他",
                "salesVolume": "7",
                "recommendText": "推荐产品",
                "recommendShow": true,
                "price": "1.00",
                'index': '9-0-3',//下标
                'countNum': '0',//输入框
                'minusBtn': true,//是否有减号
                'waysofPurchasing': '1',//购买方式1图标2文字3加减
                'shouqing': false//是否售罄
              },
              {
                "flxh": "2",
                "spid": "5",
                "number": "5",
                "newText": "热销上市",
                "newShow": false,
                "newShowRed": true,
                "productImg": "../images/index/1.png",
                "name": "其他",
                "salesVolume": "6",
                "recommendText": "推荐产品",
                "recommendShow": true,
                "price": "1.00",
                'index': '9-0-4',//下标
                'countNum': '0',//输入框
                'minusBtn': true,//是否有减号
                'waysofPurchasing': '3',//购买方式1图标2文字3加减
                'shouqing': false,//是否售罄
              },
              {
                "flxh": "3",
                "spid": "6",
                "number": "6",
                "newText": "热销上市",
                "newShow": false,
                "newShowRed": true,
                "productImg": "../images/index/1.png",
                "name": "其他",
                "salesVolume": "12",
                "recommendText": "推荐产品",
                "recommendShow": true,
                "price": "1.00",
                'index': '9-0-5',//下标
                'countNum': '0',//输入框
                'minusBtn': true,//是否有减号
                'waysofPurchasing': '2',//购买方式1图标2文字3加减
                'shouqing': false,//是否售罄
              },
              {
                "flxh": "3",
                "spid": "7",
                "number": "7",
                "newText": "热销上市",
                "newShow": false,
                "newShowRed": true,
                "productImg": "../images/index/1.png",
                "name": "其他",
                "salesVolume": "120",
                "recommendText": "推荐产品",
                "recommendShow": true,
                "price": "1.00",
                'index': '9-0-6',//下标
                'countNum': '0',//输入框
                'minusBtn': true,//是否有减号
                'waysofPurchasing': '2',//购买方式1图标2文字3加减
                'shouqing': false,//是否售罄
              }
            ]            
          },
        ]
      },
      {
        'index': 10,
        'id': 'classif10',
        'name': ' ',
        'scrollTop': '',
        'img': '',
        'classifDetail': [
          {
            'index': 10,
            'id': 'classifDetail10',
            'name': ' ',
            'scrollTop': '',
            
          },
        ]
      },
    ],

  },
  onLoad: function (options) {
      this.setData({
        //推荐消息， 订奶列表数据
        usedata: indexData.setdata,
      })
    wx.getSystemInfo({
      // 获取当前设备的宽高，文档有
      success: (res) => {
        this.setData({
          windowHeight: res.windowHeight,
          windowWidth: res.windowWidth
        })
      },
    })
    let that = this;
    wx.getSystemInfo({
      success: function (res) {
        console.log(res)
        that.setData({
          winHeight: res.windowHeight * 2 - (res.windowWidth * 90 / 750) + 'rpx'
        })
      },
    })
    var classifData = that.data.classifData;
    for (let i = 0; i < classifData.length; i++) {

      wx.createSelectorQuery().select('#' + that.data.classifData[i].id).boundingClientRect(res => { //获取评论距离页面顶部高度
        classifData[i].scrollTop = res.top
        that.setData({
          classifData: classifData
        })
      }).exec()
      for (let j = 0; j < classifData[i].classifDetail.length - 1; j++) {
        wx.createSelectorQuery().select('#' + that.data.classifData[i].classifDetail[j].id).boundingClientRect(res => { //获取评论距离页面顶部高度
          classifData[i].classifDetail[j].scrollTop = res.top
          that.setData({
            classifData: classifData
          })
        }).exec()
      }
    }

  },
  // 页面渲染 调用
  onShow: function () {
    var that = this;

    if (that.data.navbarInitTop == 0) {
      //获取节点距离顶部的距离销量价格
      wx.createSelectorQuery().select('#productContent').boundingClientRect(function (rect) {
        if (rect && rect.top > 0) {
          var navbarInitTop = parseInt(rect.top);
          that.setData({
            navbarInitTop: navbarInitTop
          });
        }
      }).exec();
    }
  },
  toViewClick: function (event) {
    console.log(event.currentTarget.dataset.current)
    this.setData({
      toView: event.currentTarget.dataset.hash,
      nowstatus: event.currentTarget.dataset.hash,
      currentTab1: event.currentTarget.dataset.current,
    })
    
    var current = event.currentTarget.dataset.current; //获取当前tab的index
    // 导航tab共5个，获取一个的宽度
    var tabWidth = this.data.windowWidth /5;
    this.setData({
      tabScroll: (current - 2) * tabWidth//使点击的tab始终在居中位置
    })
  },
  toViewClick2: function (event) {
    this.setData({
      toView: event.currentTarget.dataset.hash,
      nowstatus2: event.currentTarget.dataset.hash,
      currentTab2: event.currentTarget.dataset.current,
    })
    var current2 = event.currentTarget.dataset.current; //获取当前tab的index
    // 导航tab共5个，获取一个的宽度
    var tabWidth2 = this.data.windowWidth / 4;

    this.setData({
      tabScroll2: (current2 - 2) * tabWidth2//使点击的tab始终在居中位置
    })
  },

  onPageScroll1: function (e) {
    var that = this;
    var classifData = that.data.classifData;

    for (let i = 0; i < classifData.length - 1; i++) {
      var a = i + 1
      if (e.detail.scrollTop > classifData[i].scrollTop - scrollHeight && e.detail.scrollTop < classifData[a].scrollTop - scrollHeight-1) {
        var tabWidth = this.data.windowWidth / 6;
        this.setData({
          nowstatus: that.data.classifData[i].id,
          currentTab1: that.data.classifData[i].index,
          tabScroll: (that.data.classifData[i].index - 1) * tabWidth,
        })
        var thisIndex = i
        for (let j = 0; j < classifData[thisIndex].classifDetail.length; j++) {
          var b = j + 1;
          // if (classifData[thisIndex].classifDetail.length > 2) {
          if (classifData[thisIndex].classifDetail.length >2&&e.detail.scrollTop > classifData[i].classifDetail[j].scrollTop - 0 && e.detail.scrollTop < classifData[i].classifDetail[b].scrollTop - 1) {
           
              var tabWidth2 = this.data.windowWidth / 3;

              this.setData({
                nowstatus2: that.data.classifData[i].classifDetail[j].id,
                currentTab2: that.data.classifData[i].classifDetail[j].index,
                tabScroll2: (that.data.classifData[i].classifDetail[j].index - 1) * tabWidth2,
              })
            // }
          } else if (classifData[thisIndex].classifDetail.length == 2){
           
            if (e.detail.scrollTop > classifData[i].classifDetail[0].scrollTop ){
              console.log(classifData[i].classifDetail[j].scrollTop, e.detail.scrollTop)
              var tabWidth2 = this.data.windowWidth / 3;
              this.setData({
                nowstatus2: that.data.classifData[i].classifDetail[j].id,
                currentTab2: that.data.classifData[i].classifDetail[j].index,
                tabScroll2: (that.data.classifData[i].classifDetail[j].index  - 1) * tabWidth2,
              })
            }else{
             
              var tabWidth2 = this.data.windowWidth / 3;
              this.setData({
                nowstatus2: that.data.classifData[i].classifDetail[0].id,
                currentTab2: that.data.classifData[i].classifDetail[0].index,
                tabScroll2: (that.data.classifData[i].classifDetail[0].index   - 1) * tabWidth2,
              })              
            }

          }else {
           
            var tabWidth2 = this.data.windowWidth / 3;
            this.setData({
              nowstatus2: that.data.classifData[i].classifDetail[j].id,
              currentTab2: that.data.classifData[i].classifDetail[j].index,
              tabScroll2: (that.data.classifData[i].classifDetail[j].index  - 1) * tabWidth2,
            })
          }

        }
      }


    }
  },
  goIndexDetails: function (event) {
    var newsid = event.currentTarget.dataset.newsid;
    wx.navigateTo({
      url: '../../../pages/details/details?newsid=' + newsid
      // 跳转到商品详情
    })
  },
  onShareAppMessage: function () {
    return {
      title: '弹出分享时显示的分享标题',
      desc: '分享页面的内容',
      path: '/pages/indexDetails/indexDetails' // 路径，传递参数到指定页面。
    }
  },
  add: function (e) {
    // 加
    // classifData
    var count = this.data.classifData;
    var index = e.currentTarget.dataset.index;
    var countIndex = index.split("-");
    count[countIndex[0]].classifDetail[countIndex[1]].usedata[countIndex[2]].countNum++;
    count[countIndex[0]].classifDetail[countIndex[1]].usedata[countIndex[2]].minusBtn = false;
    this.setData({
      classifData: count
    });

  },
  minus: function (e) {
    // 减
    var count = this.data.classifData;
    var index = e.currentTarget.dataset.index;
    var countIndex = index.split("-");
    var numberCoun = count[countIndex[0]].classifDetail[countIndex[1]].usedata[countIndex[2]].countNum;
    if (numberCoun <= 1) {
      count[countIndex[0]].classifDetail[countIndex[1]].usedata[countIndex[2]].countNum  = 0;
      count[countIndex[0]].classifDetail[countIndex[1]].usedata[countIndex[2]].minusBtn = true;
    } else {
      count[countIndex[0]].classifDetail[countIndex[1]].usedata[countIndex[2]].countNum--;
      count[countIndex[0]].classifDetail[countIndex[1]].usedata[countIndex[2]].minusBtn = false;
    }
    this.setData({
      classifData: count
    });
  },
  goinviteHomeshoppingCart: function () {//跳转到购物车结算
    wx.redirectTo({
      url: '../inviteHomeshoppingCart/inviteHomeshoppingCart'
    })
  },
})